import { createStore } from 'vuex'
import { getStorage, hideLoading, showLoading } from '@/common/util'
import api from '@/common/api'

const commonStore = createStore({
	//存放状态
	state: {
		"reload": [],
		"registerData": {}
	},
	mutations: {
		addRegister(state, data) {
			state.registerData = data
		},
		addReload(state, pageName : string) {
			const idx = state.reload.indexOf(pageName)
			if (idx < 0) state.reload.push(pageName)
		},
		delReload(state, pageName : string) {
			const idx = state.reload.indexOf(pageName)
			if (idx >= 0) state.reload.splice(idx, 1)
		},
		reloadAll(state) {
			state.reload = ['userIndex']
		},
	},
})

export default commonStore